<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];

	$action = chkstr(trim($_REQUEST['action']));
	$newsid = chkstr(trim($_REQUEST['newsid']));
	if($action != "add"){
		echo "参数错1误";
		exit();
	}
	if($kboy_userid){
		if(empty($newsid)){
			echo "参数2错误";
			exit();
		}
		if(!is_numeric($newsid)){
			echo "参3数错误";
			exit();
		}

		if(getNewsNums("kboy_forum_travel_favorite","uid=$kboy_userid and newsid=$newsid")>0){
			echo "该信息已收藏，请勿重复操作";
			exit();
		}

		$mysql = new sqlstr("kboy_forum_travel_favorite"); 
		$mysql -> set("uid",$kboy_userid,true);
		$mysql -> set("newsid",$newsid,true);
		$news_sql = $mysql -> insertSql();
		$news_res = mysql_query($news_sql);
		if($news_res){
			echo "收藏成功";
			exit();
		}else{
			echo "服务器内部错误";
			exit();
		}
		
	}else{
		echo "请登录后操作";
		exit();
	}
?>